package com.inossem.warehousestorage_inossem.activity.allocation;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.inossem.utils.listener.NoDoubleClickListener;
import com.inossem.warehousestorage_inossem.R;
import com.inossem.warehousestorage_inossem.activity.allocation.in_storage.AllocationInPaperActivity;
import com.inossem.warehousestorage_inossem.activity.allocation.out_storage.AllocationOutIsHaveDocumentActivity;
import com.inossem.warehousestorage_inossem.activity.base.BaseActivity;
import com.inossem.warehousestorage_inossem.utils.ActivityUtils;
import com.inossem.warehousestorage_inossem.utils.BaseInteface;
import com.zhy.android.percent.support.PercentRelativeLayout;

/**
 * 调拨管理
 *
 * @author 詹建宇
 * @time on 2018/3/28 10:09
 * @email jianyu.zhan@inossem.com
 */
public class AllocationManageActivity extends BaseActivity implements BaseInteface,View.OnClickListener{

    private TextView title;
    private PercentRelativeLayout outStorage, inStorage;

    @Override
    protected void onCreateImpl(Bundle savedInstanceState) {
        super.onCreateImpl(savedInstanceState);
        setContentView(R.layout.cy_activity_allocating);

        initView(this);
        initData(this);
    }

    @Override
    public void initView(Activity activity) {
        outStorage = (PercentRelativeLayout) findViewById(R.id.outStorage);
        inStorage = (PercentRelativeLayout) findViewById(R.id.inStorage);
        title = (TextView) findViewById(R.id.headerTitle);

        outStorage.setOnClickListener(this);
        inStorage.setOnClickListener(this);
    }

    @Override
    public void initData(Activity activity) {
        title.setText(activity.getResources().getString(R.string.cy_activity_out_storage_allocating_creat_document));
        ActivityUtils.initBackAndFunction(activity, R.string.activity_up_frame_result_back, new NoDoubleClickListener() {
            @Override
            public void onNoDoubleClick(View v) {
                finish();
            }
        });
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.outStorage://出库
                startActivity(new Intent(this, AllocationOutIsHaveDocumentActivity.class));
                break;
            case R.id.inStorage://入库
                startActivity(new Intent(this, AllocationInPaperActivity.class));
                break;
        }
    }
}
